<template>
  <div>
    {{name}}
    {{count}}
    {{myName}}

    <button @click="setcount(1)">增加1</button>
    <button @click="setcount(2)">增加2</button>
    <button @click="setcount(3)">增加3</button>

    <button @click="awaitcount(666)">修改</button>

    <br>
    <div>{{getaddr}}</div>
    <div>地址：{{schoolAddr}}</div>
  </div>
</template>

<script>
import {mapActions, mapGetters, mapMutations, mapState} from 'vuex'
export default {
  data(){
    return{
      name:'疯狂的'
    }
  },
  mounted(){
    console.log(this.$store);
  },
  computed: {
    // 辅组函数  仓库
      ...mapState(['count']),
      ...mapState({
        myName:"name"
      }),
      // 辅组函数
      ...mapGetters(['getaddr','schoolAddr'])
  },
  methods:{
    // setcount(data){
    //   // 修改  data传入
    //   this.$store.commit('setcount',data)
    // }
    // awaitcount(data){
    //   this.$store.dispatch('awaitcount',data)
    // },
    // 辅组函数  发送
    ...mapActions(['awaitcount']),
    // 辅组函数 修改
    ...mapMutations(['setcount'])
  }
}
</script>

<style>

</style>